<!-- PAGE CONTENT BEGINS -->
<div class="row">
	<div class="col-sm-12">

		<div class="widget-box transparent">
			<div class="widget-header widget-header-flat">
				<h4 class="lighter">
					<i class="icon-star orange"></i> 任务列表
				</h4>
			</div>
		</div>

		<div class="widget-body">
			<div class="widget-main no-padding">
				<table class="table table-bordered table-striped">
					<thead class="thin-border-bottom">
						<tr>
							<th><i class="icon-caret-right blue"></i> 任务名称</th>

							<th><i class="icon-caret-right blue"></i> 任务状态</th>

						</tr>
					</thead>

					<tbody id="show-task-list">
						<tr>
							<td>批量导出</td>
							<td class="hidden-480"><span
								class="label label-info arrowed-right arrowed-in">等待中</span></td>

						</tr>

					</tbody>
				</table>
				<!-- Page navigation begin -->
				<nav aria-label="Page navigation">
					<ul class="pagination">
						<li><a href="#" aria-label="Previous"> <span
								aria-hidden="true">&laquo;</span>
						</a></li>
						<li><a href="#">1</a></li>
						<li><a href="#">2</a></li>
						<li><a href="#">3</a></li>
						<li><a href="#">4</a></li>
						<li><a href="#">5</a></li>
						<li><a href="#" aria-label="Next"> <span
								aria-hidden="true">&raquo;</span>
						</a></li>
					</ul>
				</nav>
				<!-- Page navigation end -->
			</div>
			<!-- /widget-main -->
		</div>
		<!-- /widget-body -->
	</div>
	<!-- /widget-box -->


	<div class="modal fade" id="staticBackdrop" data-backdrop="static"
		data-keyboard="false" tabindex="-1"
		aria-labelledby="staticBackdropLabel" aria-hidden="true">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title">用户登陆</h4>
				</div>
				<div class="modal-body" id="task-add-body">

					<form>
						<div class="form-group">
							<label for="username">用户名</label> <input type="email"
								class="form-control" id="username" placeholder="用户名">
						</div>
						<div class="form-group">
							<label for="userVerifyCode">验证码</label>
							<div class="row">
								<div class="col-lg-12">
									<div class="input-group">
										<input type="text" class="form-control" placeholder="验证码"
											id="userVerifyCode" name="userVerifyCode"> <span
											class="input-group-btn">
											<button class="btn btn-default" type="button" onclick="getVerifyCode2()">获取</button>
										</span>
									</div>
									<!-- /input-group -->
								</div>
								<!-- /.col-lg-6 -->
							</div>
							<!-- /.row -->
						</div>
						<div class="checkbox">
							<label> <input type="checkbox" id="" name=""> 记住我
							</label>
						</div>
					</form>

				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-default" onclick="login()">登陆</button>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
     function getVerifyCode2(){
				$.ajax({
				url : pathSpec+"/user/verify/code/" + $("#username").val(),
				type : "get",
				success : function(data, text, xhr) {
					console.log(data);
					if (xhr.status == 200) {
					}
				}
			});
		}	
		
		function login(){
			$.ajax({
				url : pathSpec+"/user/login",
				type : "post",
			    contentType: "application/json; charset=utf-8",
			    dataType: "json",
				data : JSON.stringify({userName: $("#username").val(),verifyCode: $("#userVerifyCode").val()}),
				success : function(data, text, xhr) {
					console.log(data);
					if (xhr.status == 304) {
						//window.location.href = window.location.href;
						window.location.reload()
					}
				}
			});
		}
		
		function getTaskResult(taskId) {
			console.log(taskId);
			$.ajax({
				url : pathSpec+"/job/task/result/" + taskId,
				type : "get",
				success : function(data, text, xhr) {
					console.log(data);
					if (xhr.status == 200) {
						$("#show-text" + taskId).html(
								data.results.result[0].mustacheText);
						$("#show-text" + taskId).append(
								data.results.result[1].resultText);
						eval(data.results.result[1].resultText);
					}
				}
			});
		}

		/*function getTaskList() {
			console.log("GetTaskList");
			$.ajax({
				url : "/taomubox/job/task/list",
				type : "get",
				success : function(data) {
					var results = {
						results : data
					};
					var html = template("show-task-list-template", results);
					$("#show-task-list").html(html);
					for (i = 0; i < data.length; i++) {
						getTaskResult(data[i].taskId);
					}
				}
			});
		}*/

		$(document).ready(function() {
			console.log("init");
			//getTaskList();

		});
	</script>

<!-- PAGE CONTENT ENDS -->